#include "window.h"

#include "define.h"
#include "draw.h"
#include "utils.h"
#include "control.h"
#include "terminal.h"
#include "game.h"

#include "color.h"

#define WIN_STYLE WIN_DOUBLE


namespace ui
{
    void show_windows()
    {
        tc::clean_screen();
        dw::window(1, 1, 9, 6, "Hold", WIN_STYLE);
        dw::window(1, 10, 12, 22, "Tetriz", WIN_STYLE);
        dw::window(7, 1, 9, 16, "Status", WIN_STYLE);
        dw::window(19, 22, 8, 4, "Info", WIN_STYLE);
        dw::window(1, 22, 8, 18, "Next", WIN_STYLE);
    }

    void show_game()
    {
        dw::data(8, 2, gm::score, gm::lines, gm::level);
        dw::next(gm::nextPiece, 2, 23);
        dw::hole(gm::holdPiece, 2, 2);
        dw::frame(gm::frame, 2, 11);
        std::cout<<std::flush;
    }

    void show_exit()
    {
        tc::show_cursor();
        tc::clean_screen();
        tc::move_to(1, 1);
        tc::set_fore_color(9);
        std::cout<<"Bye!";
        tc::reset_color();
    }

    void show_help()
    {
        std::ostringstream oss;
        tc::reset_color();
        tc::move_to(21,ut::b2c(24),oss);
        oss<<"help[h]";
        std::cout << oss.str();
    }

}